#!/usr/bin/bash
dir=/data/wwwroot/
git=/usr/bin/git
cd $dir >> /data/logs/wwwroot.git.pull.log
$git checkout -- . >> /data/logs/wwwroot.git.pull.log
$git clean -d -fx >> /data/logs/wwwroot.git.pull.log
$git pull origin master >> /data/logs/wwwroot.git.pull.log

if [ $? -eq 0 ]; then
    date=`/usr/bin/date +%F' '%T`
    echo "$git pull origin master [ok] $date" >> /data/logs/wwwroot.git.pull.log
fi